﻿using System;
using ProjScan.Config;
using ProjScan.Modules;
using UnityEngine;

namespace ProjScan.ScanGUI.Page
{
	// Token: 0x0200026A RID: 618
	internal class CustomRulesCheckPage : BasePage<CustomRulesCheckConfig>
	{
		// Token: 0x060010A9 RID: 4265 RVA: 0x000081A2 File Offset: 0x000063A2
		public CustomRulesCheckPage()
		{
			this.pageId = "Custom_Rules_Check";
			this.pageName = "自定义规则检测";
			this.fixModule = Module.Custom_Rules_Fix;
		}

		// Token: 0x060010AA RID: 4266 RVA: 0x000081CA File Offset: 0x000063CA
		public override void Init()
		{
			this.dicRuleInfo = this.data.dicRuleInfo;
			this.CreateRuleGUI();
		}

		// Token: 0x060010AB RID: 4267 RVA: 0x0004CD4C File Offset: 0x0004AF4C
		public override void OnGUI(Rect mainRectangle)
		{
			this.rect = mainRectangle;
			bool flag = this.data.ruleTypeDictionary.Count == 0;
			if (flag)
			{
				GUITools.LabelWithStyle(" 自定义规则使用方法： \n1. 在任意Editor目录下新建C#脚本，在此C#脚本中添加命名空间: using ProjScan.ScanRule.CustomRules; \n    新建类型并使其继承至 ICustomRule。\n2. 在上述类型实现以下4个方法: \n    a. string Description{get;} \n    b. ushort Id {get;} \n    c. RulePriority Priority {get;} \n    d. bool Run(out bool hasTable, out RuleDataTable table) \n");
				GUITools.LabelWithStyle("\n例如：\nusing ProjScan.ScanRule.CustomRules;\npublic class CustomTest1 : ICustomRule \n{\n   public string Description { get { return \"自定义规则测试用例名字\"; } }\n   public ushort Id { get { return 65521; } }\n   public RulePriority Priority { get { return RulePriority.Medium; } }\n   public bool Run(out bool hasTable, out RuleDataTable table)\n   {\n    hasTable = false; //是否显示表格 \n    table = null;         //显示表格内容\n    return true;          //当前检测是否通过\n   }\n}");
				GUITools.LabelWithStyle("\n脚本完成后即可运行自定义规则检测");
			}
			else
			{
				GUITools.LabelWithStyle("自定义规则：");
				GUITools.DrawSeparator(ScanSettingWindow.I.pageWidth - 20f);
				this.GUITitle(false);
			}
		}
	}
}
